// Convert to stream and test it boolean result = Arrays.stream(alphabet).anyMatch("A"::equals); if (result) { System.out.println("Hello A"); } Copy
if(index >= myList.size()){ //index does not exists }else{ // index exists }